<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
<script type="text/javascript" src="../Ryanjs/login/style.js"></script>
        <link href="../Ryancss/login_public.css" rel="stylesheet" type="text/css"/>
        <link href="../Ryancss/login_style.css" rel="stylesheet" type="text/css"/>
</head>
<style>

     .display-block{
     display :block;
     }

     .display-none{
     display :none;
     }
 .aui-btn-default {
    float: right;
    position: absolute;
    right: 0px;
    top: 39px;
    z-index: 10002;
    color: #ffffff;
    background: none;
    border: none;
    margin-top: -35px;
    width: 100px;
    height: 40px;
}
 .aui-flex-border {
    border-radius: 50px;
    padding: 0;
    background: #f4f3f3;
	
} 
	   
	.aui-flex {
    display: -webkit-box;
    display: -webkit-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
	
	margin: 0 auto; 
    width: 90%;

}


.aui-flex-box {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #333;
}


.aui-flex-box input {
    border: none;
    background: none;
    font-size: 0.85rem;
    padding-left: 1.4rem;
    width: 100%;
}


.aui-button-once button {
    background-image: linear-gradient(to bottom,#a442ce,#b84dc7);
    background-color: #a241cf;
    box-shadow: 0 0 19px #dd7fe6;
    color: #fff;
    font-size: 0.4rem;
    padding: 0.1rem 0.2rem;
    border-radius: 20px;
    border: none;
    position: absolute;
    margin-top: -13%;
    right: 70px;
}  

</style>
<body>
<div class="main_login">
    <div class="tit">
        <span  tapmode onclick="openWin('login')" >登录</span>
        <span class="sp2 active_tit ">注册</span>
        <div class="clear"></div>
    </div>
    <div class="main_box">

        <div class="box_con box_reg">
                <div class="con_bg">
                    <span class="first_sp"><input  id="username" type="tel"  minlength="11" maxlength="11" placeholder="输入手机号码" ></span>
                     <span class="first_sp" style="display :none;" id="display-block-dxyz"> <input id="yzcode" type="text" autocomplete="off" placeholder="短信验证码" /></span>	
					<!-- <input id="btn1" type="button"  value="获取验证码" onclick="getCode()" />	 -->
                            <div class="aui-button-once" style="display :none;" id="btn1" onclick="getCode()">
                                <button>获取</button>
                            </div>					
                    <span class="second_sp thrid_sp"><input  id="password" type="password" placeholder="请输入登录密码"/></span>
                    <span class="second_sp thrid_sp"><input id="password_reg" type="password"  placeholder="请确认登录密码"/></span>
                   <span class="invitation_sp thrid_sp " style="display :none;" id="display-block-share"><input id="share" type="text" minlength="6" maxlength="6" placeholder="邀请码"/></span>
                 <!--      <span class="second_sp thrid_sp"  ><input id="share" type="text" minlength="6" maxlength="6" placeholder="邀请码(选填)"/></span> -->
                </div>
                <a  onclick="toReg()" class="log_btn reg_btn">注册</a>

        </div>
    </div>


    <div class="footer_pic">
<!--
		<img  onclick="WX_login()" src="" alt="微信" class="pic2"/>
-->
        <img src="" class="pic1"/>
  </div>
</div>


</body>


<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript">
    var api_url = localStorage.getItem('api_url');
    var onoff = true;
    var code_data = '';
    var user = '';
    var pass = '';
	var pass02 = '';
    apiready = function () {
      api.parseTapmode();
      var header = $api.byId('aui-header');
      $api.fixStatusBar(header);
      var headerPos = $api.offset(header);
      var body_h = $api.offset($api.dom('body')).h;


    if(localStorage.getItem('Invitation_Code_Show') == '0'){

    }else{

        var obj = document.getElementById("display-block-share");
        obj.setAttribute("style", "display :block;");


    }
    if(localStorage.getItem('dxzce') == '0'){

    }else{

        var obj = document.getElementById("display-block-dxyz");
        obj.setAttribute("style", "display :block;");
        var obb = document.getElementById("btn1");
        obb.setAttribute("style", "display :block;");		


    }	



    //是否自动识别邀请码   1
    if(localStorage.getItem('Invitation_Code_Distinguish') == '1'){
          //定时检测邀请码
          var timer = setInterval(function(){
         //     DataLoading();

              var clipBoard = api.require('clipBoard');
              clipBoard.get(function(ret, err) {
                  if (ret) {


                    if (ret.value.length == 6) {
                      var share = $api.byId('share');
                      share.value = ret.value;

          /*
                  api.toast({
                          msg: '绑定归属成功',
                          duration: 4000,
                          location: 'middle'
                      });

              */


                    }



                  } else {

                  }
              });



           },3000)

        }




    }


    //注册
    function toReg(){
      var username = $api.val($api.byId('username'));
      var password = $api.val($api.byId('password'));
	  var password_reg = $api.val($api.byId('password_reg'));
      var yzcode = $api.val($api.byId('yzcode'));
      var deviceId = api.deviceId;
      var share = $api.val($api.byId('share'));
      if(username == ''){


		   api.toast({
           msg : '请输入账号',
			duration: 5000,
			location : 'middle'
          });


        return;
      }
      if(localStorage.getItem('dxzce') == '1'){
	  	  			if (yzcode == '') {
				api.alert({
					title: '警告！~',
					msg: '请输入验证码',
				});
				return;
			}
	  }	  
      if(password == '' || password_reg == ''){

		  api.toast({
           msg : '请输入密码',
			duration: 5000,
			location : 'middle'
          });

        return;
      }


      //如果强制邀请码 1
      if(localStorage.getItem('Mandatory_Invitation_Code') == '1'){


       if(share == ''){
	 /*
                api.toast({
                    msg : '请在邀请页面复制邀请码',
					duration: 5000,
					location : 'middle'
                });
	*/

												var dialogBox = api.require('dialogBox');
												dialogBox.alert({
													texts: {
													//	title: '智能识别',
														content: '请向邀请人索取正确邀请码',
														leftBtnTitle: '知道了',
													//	rightBtnTitle: '确认并使用'
													},
													styles: {
														bg: '#fff',
														w: 300,
														corner:10,
														title: {
															marginT: 20,
															icon: 'widget://Ryanimg/frame0/rrrr.png',
															iconSize: 20,
															titleSize: 14,
															titleColor: '#999'
														},
														content: {
															marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
															marginB: 20,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
															color: '#999',
															size: 14
														},
														left: {
															marginB: 30,
															marginL: 100,
															w: 100,
															h: 35,
															corner: 2,
															bg: '#eeeeee',
															color: '#999',  //（可选项）字符串类型；右边按钮标题字体颜色，支持rgb、rgba、#；默认：'#007FFF'
															size: 12
														}



													}
												}, function(ret) {

																				if (ret.eventType == 'left') {

																					//关闭弹窗
																					var dialogBox = api.require('dialogBox');
																					dialogBox.close({
																						dialogName: 'alert'
																					});




																					//清空剪贴板
																					var clipBoard = api.require('clipBoard');
																					clipBoard.set({
																						value: '爱看资源网'
																					});




																				}

																			});




         return;
       }

       }



      if(username.length < 6){


		api.toast({
           msg : '请输入6位以上账号',
			duration: 5000,
			location : 'middle'
          });
        return;
      }

	  if ($api.byId('password').value != $api.byId('password_reg').value) {
                $api.byId('password_reg').focus();
                api.toast({
                    msg : '两次密码不一致，请重新输入!',
					duration: 5000,
					location : 'middle'
                });
                return;
                 }
      //if(yzcode != code_data){
      //  api.alert({
      //      title: '错误提示',
      //      msg: '您输入的验证码不正确',
      //  });
      //  return;
      //}
      //if(localStorage.getItem('reg_name') == username){
      //}else {
        //api.alert({
        //    title: '错误提示',
       //     msg: '手机号输入不一致',
       // });
       // return;
     // }
      if(localStorage.getItem('dxzce') == '1'){	
			var moduleSMSSDK = api.require('smssdk');
			var param = {
				zone: '86',
				phoneNumber: username,
				code: yzcode
			};
    moduleSMSSDK.commitCode(param, function(ret, err) {	
	if (err !== null && err !== undefined && err !== '') {
					// 错误消息示例：{"msg":"Template not exist.","code":484}
		  api.toast({
           msg : '验证码错误',
			duration: 5000,
			location : 'middle'
          });
					return;
				}else{
				      user = $api.val($api.byId('username'));
      pass = $api.val($api.byId('password'));
	  pass02 = $api.val($api.byId('password_reg'));
      api.showProgress({
          title: '注册中',
          text: '请稍等',
          modal: false
      });
      api.ajax({
          url: api_url+'/login/login/create.html',
          method: 'get',
          data: {
              values: {
				  key: 'ikmovie.xyz',   //安全码
                  name: username,
                  password:password,
				  share_ma:share,
				  deviceId: api.deviceId,
				  type:'自由注册'
              }
          }
      },function(ret, err){
      	//alert(ret)
          if (ret) {
				if (ret.code == 10) {
                api.hideProgress();

				api.toast({
					msg: ret.msg,      //  已经注册
					duration: 5000,
                location : 'middle'
				});

				return;
				/*
                api.alert({
                    title: '错误~',
                    msg: ret.msg,
                });
				*/
				}else if (ret.code == 0) {

                api.hideProgress();

				api.toast({
					msg: ret.msg,      //  失败
					duration: 5000,
                location : 'middle'
				});

				return;


              }else if (ret.code == 9) {

					api.hideProgress();

				/*	api.toast({
						msg: ret.msg,
						duration: 5000,
					location : 'middle'
					});
				*/



												var dialogBox = api.require('dialogBox');
												dialogBox.alert({
													texts: {
													//	title: '智能识别',
														content: '请向邀请人索取正确邀请码',
														leftBtnTitle: '知道了',
													//	rightBtnTitle: '确认并使用'
													},
													styles: {
														bg: '#fff',
														w: 300,
														corner:10,
														title: {
															marginT: 20,
															icon: 'widget://Ryanimg/frame0/rrrr.png',
															iconSize: 20,
															titleSize: 14,
															titleColor: '#999'
														},
														content: {
															marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
															marginB: 20,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
															color: '#999',
															size: 14
														},
														left: {
															marginB: 30,
															marginL: 100,
															w: 100,
															h: 35,
															corner: 2,
															bg: '#eeeeee',
															color: '#999',  //（可选项）字符串类型；右边按钮标题字体颜色，支持rgb、rgba、#；默认：'#007FFF'
															size: 12
														}


													}
												}, function(ret) {

																				if (ret.eventType == 'left') {

																					//关闭弹窗
																					var dialogBox = api.require('dialogBox');
																					dialogBox.close({
																						dialogName: 'alert'
																					});



																					//清空剪贴板
																					var clipBoard = api.require('clipBoard');
																					clipBoard.set({
																						value: '爱看资源网'
																					});


																				}

																			});


																	 return;





              }else {

                api.hideProgress();

								//传递数据
									 api.sendEvent({
									  name: 'newLoingdata',
									  extra: {
										}
									});

              /*注册成功弹窗提示*/


					var dialogBox = api.require('dialogBox');
					dialogBox.alert({
                    tapClose: true,  //描述：（可选项）是否点击遮罩层关闭该对话框  默认值：false
					texts: {
					    title: '恭喜',
						content: '注册成功！超级会员已赠送',   //调用后台设置内容
					// 	leftBtnTitle: '朕知道了',
					//	rightBtnTitle: '立即升级'
					},
					styles: {
						bg: '#fff',
						w: 300,
						corner:10,
						title: {
							marginT: 20,
							icon: 'widget://Ryanimg/frame0/rrrr.png',
							iconSize: 20,
							titleSize: 14,
							titleColor: '#999'
						},
						content: {
							marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
							marginB: 20,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
							color: '#999',
							size: 14
						}

					}
				});

                /*    注册成功弹窗提示结束    */











                api.closeWin({
                    name: 'login'
                });
          //     openLogin();

////////
                api.ajax({
                    url: api_url+'/login/login/veifys.html',
                    method: 'get',
                    data: {
                        values: {
							key: 'ikmovie.xyz',   //安全码
                            username: username,
                            passwd: password,
                            imei:api.deviceId
                        }
                    }
                },function(ret, err){
                    if (ret) {
					if(ret.code == 9) { //封禁


					api.hideProgress();

						api.toast({
							msg: ret.status,
							duration: 5000,
							location : 'middle'
							});



						return;
					}else if(ret.code == 8){	//开启设备限制


					api.hideProgress();

							api.toast({
							msg: ret.status,
							duration: 5000,
							location : 'middle'
							});

						return;

					}else if(ret.code == 3) {


					api.hideProgress();

						api.toast({
							msg: '安全码错误 请联系微信 qq1207629473',
							duration: 5000,
							location : 'middle'
						});

						return;
					}else if(ret.code == 0) {
						/*    api.hideProgress();
                alert('账号或密码不正确');
  原弹窗提示  */


					api.hideProgress();


						api.toast({
							msg: '账号或密码不正确',
							duration: 5000,
							location : 'middle'
						});

						return;
					} else if(ret.code == 1) {
						/*       alert('登录成功');
						      原弹窗提示  */



						api.toast({
							msg: '登陆成功！',
							duration: 5000,
							location : 'middle'
						});

						//alert( JSON.stringify( ret ) );

						localStorage.setItem('accountLogin',0);

						localStorage.setItem('user_id', ret.msg['id']);					//用户ID
						localStorage.setItem('nick_name', ret.msg['nick_name']);			//昵称
						localStorage.setItem('parentid', ret.msg['parentid']);			//父ID
						localStorage.setItem('status', ret.msg['status']);					//封号状态
						localStorage.setItem('app_name', ret.msg['app_name']);					//APP名字
						localStorage.setItem('player_starttimes', ret.msg['player_starttimes']);					//播放器记录设置
						localStorage.setItem('user_name', username);					//用户名
						localStorage.setItem('password', password);					//密码
						localStorage.setItem('user_time', ret.msg['time']);				//会员到期时间
						localStorage.setItem('share_ma', ret.msg['share_ma']);			//邀请码
						localStorage.setItem('sign', ret.msg['sign']);				//积分
						localStorage.setItem('money', ret.msg['money']);			//余额
						localStorage.setItem('headimgurl', ret.msg['headimgurl']);			//头像
						localStorage.setItem('txje', ret.msg['txje']);			//提现金额
						localStorage.setItem('vip1', ret.msg['vip1']);			//体验
						localStorage.setItem('vip2', ret.msg['vip2']);			//月卡
						localStorage.setItem('vip3', ret.msg['vip3']);			//季卡
						localStorage.setItem('vip4', ret.msg['vip4']);			//半年
						localStorage.setItem('vip5', ret.msg['vip5']);			//一年
						localStorage.setItem('vip6', ret.msg['vip6']);			//永久
						localStorage.setItem('daili_price', ret.msg['daili_price']);			//代理升级价格
						localStorage.setItem('zfb', ret.msg['zfb']);			//支付宝
						localStorage.setItem('qdtime', ret.msg['qdtime']);			//签到时间
					//	localStorage.setItem('user_advert', ret.msg['advert']);
					//	localStorage.setItem('user_code', ret.msg['code']);
						localStorage.setItem('user_weichat', ret.msg['weichat']);			//上级微信
						localStorage.setItem('tudi', ret.msg['tudi']);			//团队数量
						localStorage.setItem('power', ret.msg['power']);			//权限
						localStorage.setItem('Source', ret.msg['Source']);			//来源

						localStorage.setItem('app_working_mode', ret.msg['app_working_mode']);			//APP 工作模式
						localStorage.setItem('vip_movies_theme', ret.msg['vip_movies_theme']);			//VIP 影视主题
						localStorage.setItem('app_share_help', ret.msg['app_share_help']);			//APP邀请页帮助信息
						localStorage.setItem('app_Invitation_slogans', ret.msg['app_Invitation_slogans']);			//APP分享 邀请标语
						localStorage.setItem('app_secret_key', ret.msg['app_secret_key']);			//APP 私人影片kEY
						localStorage.setItem('app_secret_content', ret.msg['app_secret_content']);			//APP 私人影片公告
						localStorage.setItem('index_video_num', ret.msg['index_video_num']);			//首页调用推荐影视数量
						localStorage.setItem('look_record_num', ret.msg['look_record_num']);			//观看记录保留数量
						localStorage.setItem('upload_headimg_integral', ret.msg['upload_headimg_integral']);			//上传头像赠送积分
						localStorage.setItem('set_nickname_integral', ret.msg['set_nickname_integral']);			//设置昵称赠送积分
						localStorage.setItem('upload_alipay_code_integral', ret.msg['upload_alipay_code_integral']);			//上传支付宝收款码赠送积分
						localStorage.setItem('wechat_login_code_integral', ret.msg['wechat_login_code_integral']);			//微信快捷登录赠送积分
						localStorage.setItem('agent_introduction_picture', ret.msg['agent_introduction_picture']);			//代理升级介绍图片
						localStorage.setItem('agent_upgrade_tips', ret.msg['agent_upgrade_tips']);			//会员中心无代理权限弹窗提示
						localStorage.setItem('touping_switch', ret.msg['touping_switch']);			//会员中心投屏助手按钮开关
						localStorage.setItem('touping_picture', ret.msg['touping_picture']);			//会员中心投屏助手介绍图片
						api.sendEvent({
							name: 'newLoingdata',
							extra: {}
						});

						api.hideProgress();

						api.closeWin({});

						// api.openWin({
						//     name: 'index',
						//     url: '../index.html',
						// });

					}
				} else {
                      api.hideProgress();

					api.toast({
						msg: '网络连接异常',
						duration: 5000,
					location : 'middle'
					});
                      //alert( JSON.stringify( err ) );
                      return;
                    }
                });
/////////

                api.closeWin();
              }
          } else {
            api.hideProgress();


					api.toast({
						msg: '网络连接异常',
						duration: 5000,
					location : 'middle'
					});


          }
      });
				}

	});	
	  
	  
	  }else{
	        user = $api.val($api.byId('username'));
      pass = $api.val($api.byId('password'));
	  pass02 = $api.val($api.byId('password_reg'));
      api.showProgress({
          title: '注册中',
          text: '请稍等',
          modal: false
      });
      api.ajax({
          url: api_url+'/login/login/create.html',
          method: 'get',
          data: {
              values: {
				  key: 'ikmovie.xyz',   //安全码
                  name: username,
                  password:password,
				  share_ma:share,
				  deviceId: api.deviceId,
				  type:'自由注册'
              }
          }
      },function(ret, err){
      	//alert(ret)
          if (ret) {
				if (ret.code == 10) {
                api.hideProgress();

				api.toast({
					msg: ret.msg,      //  已经注册
					duration: 5000,
                location : 'middle'
				});

				return;
				/*
                api.alert({
                    title: '错误~',
                    msg: ret.msg,
                });
				*/
				}else if (ret.code == 0) {

                api.hideProgress();

				api.toast({
					msg: ret.msg,      //  失败
					duration: 5000,
                location : 'middle'
				});

				return;


              }else if (ret.code == 9) {

					api.hideProgress();

				/*	api.toast({
						msg: ret.msg,
						duration: 5000,
					location : 'middle'
					});
				*/



												var dialogBox = api.require('dialogBox');
												dialogBox.alert({
													texts: {
													//	title: '智能识别',
														content: '请向邀请人索取正确邀请码',
														leftBtnTitle: '知道了',
													//	rightBtnTitle: '确认并使用'
													},
													styles: {
														bg: '#fff',
														w: 300,
														corner:10,
														title: {
															marginT: 20,
															icon: 'widget://Ryanimg/frame0/rrrr.png',
															iconSize: 20,
															titleSize: 14,
															titleColor: '#999'
														},
														content: {
															marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
															marginB: 20,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
															color: '#999',
															size: 14
														},
														left: {
															marginB: 30,
															marginL: 100,
															w: 100,
															h: 35,
															corner: 2,
															bg: '#eeeeee',
															color: '#999',  //（可选项）字符串类型；右边按钮标题字体颜色，支持rgb、rgba、#；默认：'#007FFF'
															size: 12
														}


													}
												}, function(ret) {

																				if (ret.eventType == 'left') {

																					//关闭弹窗
																					var dialogBox = api.require('dialogBox');
																					dialogBox.close({
																						dialogName: 'alert'
																					});



																					//清空剪贴板
																					var clipBoard = api.require('clipBoard');
																					clipBoard.set({
																						value: '爱看资源网'
																					});


																				}

																			});


																	 return;





              }else {

                api.hideProgress();

								//传递数据
									 api.sendEvent({
									  name: 'newLoingdata',
									  extra: {
										}
									});

              /*注册成功弹窗提示*/


					var dialogBox = api.require('dialogBox');
					dialogBox.alert({
                    tapClose: true,  //描述：（可选项）是否点击遮罩层关闭该对话框  默认值：false
					texts: {
					    title: '恭喜',
						content: '注册成功！超级会员已赠送',   //调用后台设置内容
					// 	leftBtnTitle: '朕知道了',
					//	rightBtnTitle: '立即升级'
					},
					styles: {
						bg: '#fff',
						w: 300,
						corner:10,
						title: {
							marginT: 20,
							icon: 'widget://Ryanimg/frame0/rrrr.png',
							iconSize: 20,
							titleSize: 14,
							titleColor: '#999'
						},
						content: {
							marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
							marginB: 20,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
							color: '#999',
							size: 14
						}

					}
				});

                /*    注册成功弹窗提示结束    */











                api.closeWin({
                    name: 'login'
                });
          //     openLogin();

////////
                api.ajax({
                    url: api_url+'/login/login/veifys.html',
                    method: 'get',
                    data: {
                        values: {
							key: 'ikmovie.xyz',   //安全码
                            username: username,
                            passwd: password,
                            imei:api.deviceId
                        }
                    }
                },function(ret, err){
                    if (ret) {
					if(ret.code == 9) { //封禁


					api.hideProgress();

						api.toast({
							msg: ret.status,
							duration: 5000,
							location : 'middle'
							});



						return;
					}else if(ret.code == 8){	//开启设备限制


					api.hideProgress();

							api.toast({
							msg: ret.status,
							duration: 5000,
							location : 'middle'
							});

						return;

					}else if(ret.code == 3) {


					api.hideProgress();

						api.toast({
							msg: '安全码错误 请联系微信 qq1207629473',
							duration: 5000,
							location : 'middle'
						});

						return;
					}else if(ret.code == 0) {
						/*    api.hideProgress();
                alert('账号或密码不正确');
  原弹窗提示  */


					api.hideProgress();


						api.toast({
							msg: '账号或密码不正确',
							duration: 5000,
							location : 'middle'
						});

						return;
					} else if(ret.code == 1) {
						/*       alert('登录成功');
						      原弹窗提示  */



						api.toast({
							msg: '登陆成功！',
							duration: 5000,
							location : 'middle'
						});

						//alert( JSON.stringify( ret ) );

						localStorage.setItem('accountLogin',0);

						localStorage.setItem('user_id', ret.msg['id']);					//用户ID
						localStorage.setItem('nick_name', ret.msg['nick_name']);			//昵称
						localStorage.setItem('parentid', ret.msg['parentid']);			//父ID
						localStorage.setItem('status', ret.msg['status']);					//封号状态
						localStorage.setItem('app_name', ret.msg['app_name']);					//APP名字
						localStorage.setItem('player_starttimes', ret.msg['player_starttimes']);					//播放器记录设置
						localStorage.setItem('user_name', username);					//用户名
						localStorage.setItem('password', password);					//密码
						localStorage.setItem('user_time', ret.msg['time']);				//会员到期时间
						localStorage.setItem('share_ma', ret.msg['share_ma']);			//邀请码
						localStorage.setItem('sign', ret.msg['sign']);				//积分
						localStorage.setItem('money', ret.msg['money']);			//余额
						localStorage.setItem('headimgurl', ret.msg['headimgurl']);			//头像
						localStorage.setItem('txje', ret.msg['txje']);			//提现金额
						localStorage.setItem('vip1', ret.msg['vip1']);			//体验
						localStorage.setItem('vip2', ret.msg['vip2']);			//月卡
						localStorage.setItem('vip3', ret.msg['vip3']);			//季卡
						localStorage.setItem('vip4', ret.msg['vip4']);			//半年
						localStorage.setItem('vip5', ret.msg['vip5']);			//一年
						localStorage.setItem('vip6', ret.msg['vip6']);			//永久
						localStorage.setItem('daili_price', ret.msg['daili_price']);			//代理升级价格
						localStorage.setItem('zfb', ret.msg['zfb']);			//支付宝
						localStorage.setItem('qdtime', ret.msg['qdtime']);			//签到时间
					//	localStorage.setItem('user_advert', ret.msg['advert']);
					//	localStorage.setItem('user_code', ret.msg['code']);
						localStorage.setItem('user_weichat', ret.msg['weichat']);			//上级微信
						localStorage.setItem('tudi', ret.msg['tudi']);			//团队数量
						localStorage.setItem('power', ret.msg['power']);			//权限
						localStorage.setItem('Source', ret.msg['Source']);			//来源

						localStorage.setItem('app_working_mode', ret.msg['app_working_mode']);			//APP 工作模式
						localStorage.setItem('vip_movies_theme', ret.msg['vip_movies_theme']);			//VIP 影视主题
						localStorage.setItem('app_share_help', ret.msg['app_share_help']);			//APP邀请页帮助信息
						localStorage.setItem('app_Invitation_slogans', ret.msg['app_Invitation_slogans']);			//APP分享 邀请标语
						localStorage.setItem('app_secret_key', ret.msg['app_secret_key']);			//APP 私人影片kEY
						localStorage.setItem('app_secret_content', ret.msg['app_secret_content']);			//APP 私人影片公告
						localStorage.setItem('index_video_num', ret.msg['index_video_num']);			//首页调用推荐影视数量
						localStorage.setItem('look_record_num', ret.msg['look_record_num']);			//观看记录保留数量
						localStorage.setItem('upload_headimg_integral', ret.msg['upload_headimg_integral']);			//上传头像赠送积分
						localStorage.setItem('set_nickname_integral', ret.msg['set_nickname_integral']);			//设置昵称赠送积分
						localStorage.setItem('upload_alipay_code_integral', ret.msg['upload_alipay_code_integral']);			//上传支付宝收款码赠送积分
						localStorage.setItem('wechat_login_code_integral', ret.msg['wechat_login_code_integral']);			//微信快捷登录赠送积分
						localStorage.setItem('agent_introduction_picture', ret.msg['agent_introduction_picture']);			//代理升级介绍图片
						localStorage.setItem('agent_upgrade_tips', ret.msg['agent_upgrade_tips']);			//会员中心无代理权限弹窗提示
						localStorage.setItem('touping_switch', ret.msg['touping_switch']);			//会员中心投屏助手按钮开关
						localStorage.setItem('touping_picture', ret.msg['touping_picture']);			//会员中心投屏助手介绍图片
						api.sendEvent({
							name: 'newLoingdata',
							extra: {}
						});

						api.hideProgress();

						api.closeWin({});

						// api.openWin({
						//     name: 'index',
						//     url: '../index.html',
						// });

					}
				} else {
                      api.hideProgress();

					api.toast({
						msg: '网络连接异常',
						duration: 5000,
					location : 'middle'
					});
                      //alert( JSON.stringify( err ) );
                      return;
                    }
                });
/////////

                api.closeWin();
              }
          } else {
            api.hideProgress();


					api.toast({
						msg: '网络连接异常',
						duration: 5000,
					location : 'middle'
					});


          }
      });
	  }	 

    }

    //页面传参
    function openLogin(){
        var delay = 0;
        if(api.systemType != 'ios'){
            delay = 300;
        }


        api.openWin({
            name: 'login',
            url: './login.html',
            pageParam:{user:user,pass:pass},
        });
    }

    //获取验证码
    function getCode1(){
      var yzcode = $api.val($api.byId('yzcode'));
      var btn1 = $api.byId('btn1');
      var username = $api.val($api.byId('username'));
      localStorage.setItem('reg_name',username);
      if (!onoff) {
        return;
      }
      onoff = false;

      if(username == ''){
        api.alert({
            title: '警告！',
            msg: '请输入手机号码',
        });
        onoff = true;
        return;
      }
      if(username.length != 11){
        api.alert({
            title: '警告！',
            msg: '请输入11位手机号码',
        });
        onoff = true;
        return;
      }
      code_data = RndNum(6);
      var content = escape('#code#='+code_data);
      //alert(code_data);
      api.ajax({
          url: 'http://v.juhe.cn/sms/send?mobile='+username+'&tpl_id=103638tpl_value='+content+'&key=bd5031f27476d9495207b3aa65b06b7d',
          method: 'get'
      },function(ret, err){
        // if (ret) {
        //   alert( JSON.stringify( ret ) );
        // }else {
        //   alert( JSON.stringify( err ) );
        // }

              api.toast({
                  msg: '发送成功',
                  duration: 1000,
                  location: 'middle'
              });
              var nuw = 60;
              var timer = setInterval(function(){
                nuw --;

                if (nuw < 1) {
                  btn1.innerHTML = '<button>获取</button>';
                  clearInterval(timer);
                  onoff = true;
                }else {
                  btn1.innerHTML = '<button>'+nuw+'s</button>';
                }


              },1000)
      });


    }
		//获取验证码
		function getCode() {
			var yzcode = $api.val($api.byId('yzcode'));
			var btn1 = $api.byId('btn1');
			var username = $api.val($api.byId('username'));
			localStorage.setItem('reg_name', username);
			if (!onoff) {
				return;
			}
			onoff = false;

			if (username == '') {
				api.alert({
					title: '警告！',
					msg: '请输入手机号码',
				});
				onoff = true;
				return;
			}
			if (username.length != 11) {
				api.alert({
					title: '警告！',
					msg: '请输入11位手机号码',
				});
				onoff = true;
				return;
			}
			var moduleSMSSDK = api.require('smssdk');
			var param = {
				zone: '86',
				phoneNumber: username,
				tempCode: ''
			};
			moduleSMSSDK.getTextCode(param, function(ret, err) {
				if (err !== null && err !== undefined && err !== '') {
					// 错误消息示例：{"msg":"Template not exist.","code":484}
					alert("Error:\n" + JSON.stringify(err));
				} else {
					// 正常消息示例：{"smart":false}
					api.toast({
						msg: '发送成功',
						duration: 1000,
						location: 'middle'
					});
					var nuw = 60;
					var timer = setInterval(function() {
						nuw--;
						if (nuw < 1) {
							btn1.innerHTML = "获取验证码";
							clearInterval(timer);
							onoff = true;
						} else {
							btn1.innerHTML = nuw + 's';
						}
					}, 1000)
				}
			});


		}

    //生成验证码
    function RndNum(n){
      var rnd="";
      for(var i=0;i<n;i++)
          rnd+=Math.floor(Math.random()*10);
      return rnd;
    }


    function closeWin(){
        api.closeWin({
        });
    }


		function openWin(name) {
			var delay = 0;
			if(api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name: name,
				url: name + '.html',
				bounces: false,
				delay: delay,
				slidBackEnabled: true,
				bgColor: '#000',
				animation: {
					type: "reveal", //动画类型（详见动画类型常量）
					subType: "from_left", //动画子类型（详见动画子类型常量）
					duration: 400
				},
				vScrollBarEnabled: false
			});
		}
</script>

</html>
